import request from './request'
import qs from 'qs'
export const getVerify = phone => request.post('/sendSMS', `phone=${phone}`)

// export const phoneLoginApi=data=>request.post('/phoneRegin', `verifyCode=${data.code}&phone=${data.phone}`)
export const phoneLoginApi = params => request.post('/phoneRegin', qs.stringify(params))
export const getUserInfoApi = () => request.get('/shop/userProfiles')
export const WXLoginApi=code=>request.post('/wechatUsers/PCLogin',qs.stringify({code}))
// export const WXLoginApi = code => request.post(`/wechatUsers/PCLogin`, `code=${code}`)

// 精品推荐
export const Recommend = () => request.get('/products/recommend');

// 热门兑换
export const Hot = () => request.get('/products/hot');

// 更多商品
export const AllGoodsApi = params => request.get('/products', { params })

export const GoodsDetail = params => request.get(`/products/${params}`)

// 加入购物车
export const AddCartApi=params=>request.post('/shop/carts/add',qs.stringify(params))

export const selectCartApi=()=>request.get('/shop/carts');

export const deleteCartApi=id=>request.delete(`/shop/carts?productIds=${id}`)
